'use strict'
module.exports = {
    publicPath: './',
    lintOnSave: process.env.NODE_ENV === 'development',
    productionSourceMap: false,
    devServer: {
        proxy: {
            ['/api']:{
                target:`http://127.0.0.1:8000/`,
                changeOrigin:true,
                pathRewrite: {
                    ['^/api']: ''
                }
            }
        }
    },
    configureWebpack: config => {
            config.optimization = {
                splitChunks: {
                    cacheGroups: {
                        common: {
                            name: "chunk-common",
                            chunks: "initial",
                            minChunks: 2,
                            maxInitialRequests: 5,
                            minSize: 0,
                            priority: 1,
                            reuseExistingChunk: true,
                            enforce: true
                        },
                        vendors: {
                            name: "chunk-vendors",
                            test: /[\\/]node_modules[\\/]/,
                            chunks: "initial",
                            //maxSize: 1024000,
                            priority: 2,
                            reuseExistingChunk: true,
                            enforce: true
                        },
                        elementPlus: {
                            name: "chunk-element-plus",
                            test: /[\\/]node_modules[\\/]element-plus[\\/]/,
                            chunks: "all",
                            priority: 3,
                            reuseExistingChunk: true,
                            enforce: true
                        }
                    }
                }
            };
    },
}
